﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using METU_CMT.Business;
using METU_CMT.Business.Compression;

namespace METU_CMT
{
    public partial class ShowLectureNotesScreen : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                BindLectureNotes();
            }
        }

        public void BindLectureNotes()
        {
            Course _currentCourse = EntityFactory.GetCurrentCourse(UserType.Student);
            dtgLectureNotes.DataSource = _currentCourse.LectureNotes;
            dtgLectureNotes.DataBind();
        }

        protected void onLnkBtnNoteNameClicked(object sender, EventArgs e)
        {
            int _noteId = CommonMethods.GetIdFromGridViewRow((GridViewRow)((LinkButton)(sender)).NamingContainer);
            Course _currentCourse = (Course)EntityFactory.GetCurrentCourse(UserType.Student);
            _currentCourse.LectureNotes.Find(note => note.NoteId == _noteId).Download();

        }

    }
}